import React from "react"
import SearchInput from "../../SearchInput"

export default class CurrentHead extends React.Component{

  constructor(){
    super();
    this.state = {
      inputContent: '搜索你想要的区域'
    }
  }

  backLastPage(){
    window.history.back();
  }

  searchKeyWordFun(value){
    this.props.history.push('/currentpage/'+encodeURIComponent(value))
  }

  render () {
    let { inputContent } = this.state
    return (
      <div className="home-header-container">
          <div className="home-header-left" onClick={this.backLastPage.bind(this)}>
              <i className="iconfont icon-zuo"></i>
          </div>
          <div className="home-header-middle">
              <SearchInput 
                inputContent={inputContent} 
                searchKeyWordFun={this.searchKeyWordFun.bind(this)}
                keyWords={this.props.keyWords}
              />
          </div>
          <div className="home-header-right">
              <i className="iconfont icon-weizhi"></i>
          </div>
      </div>
    )
  }
}

